package com.example.pattern.iterator;

/**
 * 实现
 *
 * @author FM_南风
 * @date 2024/7/6
 */
public class IteratorClient  {
	public static void main(String[] args) {
		ConcreteAggregate<String> aggregate = new ConcreteAggregate<>();
		aggregate.add("Item 1");
		aggregate.add("Item 2");
		aggregate.add("Item 3");

	 	IteratorPatternIterator<String> iterator = aggregate.createIterator();

	 	while (iterator.hasNext()) {
	  		String item = iterator.next();
	  		System.out.println("Item: " + item);
	 	}
	}
}